﻿using DotNetExtensions.Core.Autofac;
using DotNetExtensions.Core.MVC;
using DotNetExtensions.Core.SqlSugar;
using DotNetExtensions.Core.WebApi.Services;
using SqlSugarSimple.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SqlSugarSimple.Services
{
    public class MyBaseService<TModel, TKey, TSession, TSearchModel> : SimpleService<TModel,TKey,TSession,TSearchModel> where TModel : class, new() where TSearchModel : SearchModel where TSession : class, new()
    {
        public new MysqlRepository<TModel, TKey> Repository;
        public MysqlRepository<TEntity, int> MysqlRepository<TEntity>() where TEntity : class, new()
        {
            return RegistTypeResolver.Default.Resolve<MysqlRepository<TEntity, int>>();
        }

        public MyBaseService(Session<TSession> session, MysqlRepository<TModel, TKey> simpleRepository) : base(session, simpleRepository)
        {
            Repository = simpleRepository;
        }
    }
}
